<?php



for($i=1;$i<=5;$i++){
    $p=new swoole_process(function(swoole_process $worker)use($i){
        callBack($worker,$i);
    });
    $p->start();

}

function callBack(swoole_process $worker,$i){
    $redis = new Redis();
    $redis->connect( '127.0.0.1', 6379 );
    while(1){
        $r=$redis->sismember( "uid", $i );
        if($i==4){
            echo $worker->pid."---[".$i."]-----------------".var_export($r,1).PHP_EOL;
        }else{
            echo $worker->pid."---".$i."----".var_export($r,1).PHP_EOL;
        }

        sleep(1);
    }



}

while(1){
    $r=swoole_process::wait();
    print_r($r);
}